from django.db import models

# Create your models here.
class FoodType(models.Model):
    title = models.CharField(verbose_name="类别",max_length=100)
    def __str__(self):
        return self.title
    class Meta:
        verbose_name = "美食分类"
        verbose_name_plural = "美食分类"


class Food(models.Model):
    title = models.CharField(verbose_name="名字",max_length=100)
    price = models.FloatField(verbose_name="价格")
    food_type = models.ForeignKey(verbose_name="分类",to="FoodType",on_delete=models.CASCADE)
    info = models.TextField(verbose_name="简介",max_length=200,)
    food_img = models.ImageField(verbose_name="美食预览",upload_to="food_img")
    def __str__(self):
        return self.title
    class Meta:
        verbose_name = "美食"
        verbose_name_plural = "美食"


class Abs(models.Model):
    title = models.CharField(verbose_name="图片名",max_length=100)
    url = models.URLField(verbose_name="链接地址")
    img = models.ImageField(verbose_name="图片文件",upload_to="abs_img")
    def __str__(self):
        return self.title
    class Meta:
        verbose_name = "轮播图"
        verbose_name_plural = "轮播图"


